//package com.example.hackercore.filter;
//
//import com.example.hackercore.util.JwtUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import java.io.IOException;
//
///**
// * Description：
// *
// * @Author: cw
// * CreateTime：2022-10-11
// */
//@Order(1)
//@Component
//public class JwtFilter implements Filter {
//
//    private static final Logger log = LoggerFactory.getLogger(JwtFilter.class);
//
//    private static final String xtoken = "xtoken";
//
//
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletRequest request = (HttpServletRequest)servletRequest;
//        String uri = request.getRequestURI();
//
//        if("/authentication/info".equals(uri)){
//            filterChain.doFilter(servletRequest,servletResponse);
//        } else {
//            String token = request.getHeader(xtoken);
//            if(null != JwtUtil.verifierJwt(token)){
//                if(!JwtUtil.checkToken(token)){
//                    filterChain.doFilter(servletRequest,servletResponse);
//                }
//                log.info("token已过期");
//            }
//            log.info("token鉴权失败");
//        }
//    }
//
//}
